package com.stark.lock.aop;

import lombok.Data;
import org.springframework.util.Assert;

import java.lang.reflect.Method;

/**
 * 作用于<strong>方法上</strong>的注解的根元素。
 * <p>支持 <code>#root.targetClass</code> 、<code>#root.methodName</code> 等。
 *
 * @author Ben
 * @version 1.0.0
 * @since 1.0.0
 */
@Data
public class MethodExpressionRootObject {

    private final Method method;

    private final String methodName;

    private final Object[] args;

    private final Object target;

    private final Class<?> targetClass;

    public MethodExpressionRootObject(Method method, Object[] args, Object target, Class<?> targetClass) {
        Assert.notNull(method, "Method is required");
        Assert.notNull(targetClass, "targetClass is required");
        this.method = method;
        this.methodName = method.getName();
        this.target = target;
        this.targetClass = targetClass;
        this.args = args;
    }

}
